package com.googlecode.garbagecan.clickstudy.page.table;

import com.googlecode.garbagecan.clickstudy.BorderTemplate;
import com.googlecode.garbagecan.clickstudy.service.customer.CustomerService;
import org.apache.click.control.Column;
import org.apache.click.control.Table;
import org.apache.click.util.Bindable;

public class SimpleTablePage extends BorderTemplate {
	@Bindable
	protected String title = "Simple Table";

	@Bindable
	protected Table table = new Table();

	public SimpleTablePage() {
		table.setClass(Table.CLASS_ITS);
		table.addColumn(new Column("id"));
		table.addColumn(new Column("name"));
		table.addColumn(new Column("email"));
		table.addColumn(new Column("investments"));
	}

	@Override
	public void onRender() {
		table.setRowList(CustomerService.getInstance().getAllCustomers());
	}
}
